*********************************************************
* Master Do-File for:
*
* The Value of Ratings: Evidence from their Introduction in Securities Markets
*
* Authors: Asaf Bernstein, Carola Frydman, Eric Hilt
*
* Description: This master file executes do-files that produce 
* all of the tables and figures of the paper, 
* except Figure 1 which is generated by a separate Matlab file
*
* Code last updated: 5/23/25
*
*************************************************************

*************************************************************
* I. Initial Code Settings/Directories
*************************************************************

clear all
* Set to folder of where do file is saved. Change if necessary.
cd "`=substr(c(current_do), 1, indexnot(c(current_do), "/", -1))'"

*************************************************************
* II. Data setup programs
*************************************************************

qui do Part0A_SetupCode_Suprises.do

qui do Part0B_SetupCode_BidAsk.do


*************************************************************
* III. Generate results
*************************************************************

*Tables 1,2,3,4,5,6 and Figure 2

    do Part1_Surprises

*Tables 7, 8 and 9

    do Part2_BidAsk

    do Part3_AnyTrade

    do Part4_BlockSize

*Get rid of dta files created by programs

    erase "BondTransactionsAndRatingsWithSurprises.dta" 
    erase "spreads_instrument_bidask_data_cross-section.dta"
    erase "spreads_instrument_bidask_data_panel.dta"
